package com.autosalon.model;

import java.io.Serializable;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name = "BANKA")
public class Banka implements Serializable, IModelClass{
	
	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	private Long id;
	
	@Column(name="NAZEV_BANKY",length = 60, nullable = false)
	private String nazevBanky;
	
	
	@OneToMany(cascade = CascadeType.ALL)
	@JoinColumn(name = "ID_BANKY")
	private List<Pujcka> pujcky;


	@Override
	public Long getId() {
		return id;
	}


	public String getNazevBanky() {
		return nazevBanky;
	}


	public void setNazevBanky(String nazevBanky) {
		this.nazevBanky = nazevBanky;
	}


	public List<Pujcka> getPujcky() {
		return pujcky;
	}


	public void setPujcky(List<Pujcka> pujcky) {
		this.pujcky = pujcky;
	}

        @Override
        public String toString() {
            return nazevBanky;
        }
	
	
}
